package salaryService;

import salaryEntity.managerEntity;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import static salaryDao.employeeDao.checkManagerNamePassword;

public class loginDeal extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
       String name=(String)req.getParameter("name");
       String password=(String)req.getParameter("password");
//        System.out.printf("name :"+name);
        managerEntity st=checkManagerNamePassword(name,password);
//        System.out.printf("dsvs"+st);
        if (st!=null){

            resp.sendRedirect("Backgroundlogin.jsp");
        }
        else {
//            req.setAttribute("loginMsg","用户名或者密码错误！！！");
            req.getRequestDispatcher("login.jsp").forward(req,resp);
        }
    }
}
